package com.md.threadtest.callno;

/**
 * @Author Gong
 * @Description
 * @dATE 2022/3/29 10:41
 **/
public class PutongThread implements Runnable{
    private Thread texvThread;
    PutongThread(Thread texvThread){
        this.texvThread = texvThread;
    }
    @Override
    public void run() {
        for (int i = 0; i < 50; i++) {
            if(i == 10){
                try {
                    System.out.println(Thread.currentThread().getName()+"等待特需号看完。");
                    texvThread.join();
                    System.out.println("特需号已看完。");
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
            try {
                Thread.sleep(50);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            System.out.println(Thread.currentThread().getName()+":"+i);
        }
    }
}
